package com.game.action;


import com.game.logic.items.title.UserTitle;
import com.game.logic.items.title.UserTitleService;
import com.game.logic.items.title.message.UserTitleList;
import com.xs.action.annotate.ActionController;
import com.xs.action.annotate.ActionMethod;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

/// 11-称号
@Slf4j
@ActionController(11)
@RestController
@RequestMapping("/UserTitle")
public class UserTitleAction {
    @Resource
    private UserTitleService userTitleService;

    /// 1.查找
    @GetMapping("/select")
    @ActionMethod(1)
    public UserTitle select(Integer userInfoId, Integer title) {
        return userTitleService.select(userInfoId, title);
    }

    /// 2.称号列表
    @GetMapping("/list")
    @ActionMethod(2)
    public List<UserTitleList> list(Integer[] userInfoIds) {
        return Arrays.stream(userInfoIds).map(userInfoId -> userTitleService.list(userInfoId)).toList();
    }

    /// 4.穿戴
    @GetMapping("/wear")
    @ActionMethod(4)
    public UserTitle wear(Integer userInfoId, Integer title) {
        return userTitleService.wear(userInfoId, title);
    }
}
